package com.laikan.reader.bookfriend.adapter.support.impl;

import android.util.Log;
import com.laikan.reader.R;
import com.laikan.reader.bookfriend.adapter.support.MultiItemTypeSupport;
import com.laikan.reader.bookfriend.entity.ItemShorteBean;

public class ShorteSupport implements MultiItemTypeSupport<ItemShorteBean> {

    public static final int ITEM_TYPE_IMG_RIGHT = 2;
    public static final int ITEM_TYPE_IMG_LEFT = 3;
    public static final int ITEM_TYPE_NO_IMG = 4;
    public static final int ITEM_TYPE_BIG_IMG = 5;

    @Override
    public int getLayoutId(int itemType) {
        int layoutId = -1;
        switch (itemType) {
            case ITEM_TYPE_NO_IMG:
                layoutId = R.layout.view_item_template_img_none;
                break;
            case ITEM_TYPE_IMG_RIGHT:
                layoutId = R.layout.view_item_template_img_right;
                break;
            case ITEM_TYPE_BIG_IMG:
                layoutId = R.layout.view_item_template_big_img;
                break;
        }
        return layoutId;
    }

    @Override
    public int getItemViewType(int position, ItemShorteBean bean) {
        String type = bean.type;
        if ("1".equals(type)) {//没有图片
            Log.d("", "");
            return ITEM_TYPE_NO_IMG;
        } else if ("2".equals(type)) {//图片在右边
            return ITEM_TYPE_IMG_RIGHT;
        } else if ("3".equals(type)) {//大图片
            return ITEM_TYPE_BIG_IMG;
        }
        return ITEM_TYPE_NO_IMG;
    }
}